package com.platform.controller;

import com.platform.data.WebsocketData;
import com.platform.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("sys/monitor")
public class SysMonitorController {

    @Autowired
    private TestService testService;
    @GetMapping("startPlay")
    public String test(@RequestParam String sessionId){
        // 异步
        new Thread(() -> testService.selectVideo(sessionId)).start();
//        testService.selectVideo(sessionId);
        return "成功";
    }

    @GetMapping("direction")
    public String test2(WebsocketData websocketData){
        testService.getX().set(websocketData.getX());
        testService.getY().set(websocketData.getY());
        return "成功";
    }
}
